package com.example.ruiji.config;

import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;



@Component
public class Luanmaconfig implements Filter {

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("过滤器执行了");
        //前端如果发送的是post请求 而且请求中有乱码
        //  我们把前端发送过来的请求中文字使用UTF-8进行重新编码
        servletRequest.setCharacterEncoding("utf-8");
        //让请求继续往下走
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
